home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Speccy ClassiX 1998
/
Speccy ClassiX 98.iso
/
amiga_system
/
the_aminet
/
dev
/
gcc
/
ixemulsdk.lha
/
man
/
cat3
/
strsep.0
< prev
next >
Wrap
Text File
|
1992-08-10
|
2KB
|
67 lines
STRSEP(3) UNIX Programmer's Manual STRSEP(3)
NNAAMMEE
ssttrrsseepp - separate strings
SSYYNNOOPPSSIISS
##iinncclluuddee <<ssttrriinngg..hh>>
_c_h_a_r _*
ssttrrsseepp(_c_h_a_r _*_*_s_t_r_i_n_g_p, _c_h_a_r _*_d_e_l_i_m)
DDEESSCCRRIIPPTTIIOONN
The ssttrrsseepp() locates in the null¡terminated string at _*_s_t_r_i_n_g_p the first
occurence of any character in _d_e_l_i_m and replaces this with a `\0',
records the location of the immediate following character in _*_s_t_r_i_n_g_p,
then returns the original value of _*_s_t_r_i_n_g_p. If no delimiter characters
are found, ssttrrsseepp() sets _*_s_t_r_i_n_g_p to NULL; if _*_s_t_r_i_n_g_p is initially NULL,
ssttrrsseepp() returns NULL.
EEXXAAMMPPLLEESS
The following uses ssttrrsseepp() to parse strings containing runs of white
space, making up an argument vector:
char inputstring[100];
char **argv[51], **ap = argv, *p, *val;
/* set up inputstring */
for (p = inputstring; p != NULL; ) {
while ((val = strsep(&p, " \t")) != NULL && *val == '\0');
*ap++ = val;
}
*ap = 0;
HHIISSTTOORRYY
The ssttrrsseepp() function is currently under development.
BSD Experimental April 19, 1991 1